package praca.impl;

import praca.framework.DynamicGameObject;
import praca.framework.Vector;

public class Fish extends DynamicGameObject{

	public float angle = 0;
	Vector touchVector;
	float time = 0.5f;
	float increment = 0;
	
	
	public Fish(float x, float y, float width, float height) {
		super(x, y, width, height);
	}
	
	public void update(float deltaTime){
		position.x = position.x+velocity.x*deltaTime;
		position.y = position.y+velocity.y*deltaTime;
		angle = angle +increment;
	}
	
	public void setDistance(float x, float y, Vector touchVector){
		position.x = x;
		position.y = y;
		
		this.touchVector = touchVector;
		Vector odleglosc = new Vector(touchVector.x-position.x, touchVector.y-position.y);
		
		velocity.x = odleglosc.x/time;
		velocity.y = odleglosc.y/time;
		increment = odleglosc.len()/10;
		if(increment > 25)
			increment = 25;
	}

}
